#if !defined(MESHCONTAINER_H)
#define MESHCONTAINER_H

#include <d3dx9.h>

struct TMaterial : D3DXMATERIAL
{
	IDirect3DTexture9 *pTexture;
};

struct TMyVertex
{
	D3DXVECTOR3 pos;
	D3DCOLOR	col;
};

/*! \struct TMeshContainer
	\brief	Holds every data needed to work with mesh hierarchies (animated *.x-files). */
struct TMeshContainer : D3DXMESHCONTAINER
{
	ID3DXMesh					*pOrigMesh;				//!< Original mesh.
	ID3DXMesh					*pSkinnedMesh;			//!< Skinned mesh.
	D3DXMATRIX					**ppCombinedMatrices;	//!< Pointer array to the combined transformation matrices.
	D3DXMATRIX					*pBoneOffsetMatrices;	//!< Bone offset matrices.
	D3DXMATRIX					*pBoneMatrices;			//!< Bone matrices.
	ID3DXBuffer					*pBoneCombBuf;			//!< Bone combination buffer.
	IDirect3DVertexBuffer9		*pVBAabb;				//!< AABB Vertex Buffer.
	IDirect3DIndexBuffer9		*pIBAabb;				//!< AABB Index Buffer.
	IDirect3DVertexDeclaration9 *pVDAabb;				//!< AABB Vertex Declaration.
	DWORD						iStrideAabb;			//!< Vertex stride of the AABB vertices.
	TMyVertex					pVertices[8];			//!< AABB vertices.
	UINT						iIndices[24];			//!< AABB indices.
	ID3DXEffect					*pEffect;
	TMaterial					*pMaterials;			//!< Materials which hold textures and ambient, diffuse, etc. values.
	D3DXVECTOR3					vAabbMin;				//!< AA-Bounding-Box minimum extents
	D3DXVECTOR3					vAabbMax;				//!< AA-Bounding-Box maxium extents
	DWORD						iMaxInfluences;			//!< Maximum number of bone influences.
	DWORD						iNumAttrGroups;			//!< Number of attribute groups.
	DWORD						iNumBones;				//!< Number of bones.
	DWORD						iNumFaces;				//!< Number of faces.
	DWORD						iNumPalettes;			//!< Number of skinning palettes.
};

#endif // MESHCONTAINER_H